package com.chixing.ih.module.admin.service.Impl;

import com.chixing.ih.module.admin.mapper.AdminUserMapper;
import com.chixing.ih.module.admin.service.IAdminUserService;
import com.chixing.ih.module.system.pojo.User;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class AdminUserServiceImpl implements IAdminUserService {

    @Autowired
    private AdminUserMapper adminUserMapper;

    @Override
    public List<User> getOrdinaryUser(Integer pageNum, Integer pageSize,String keyword) {
        PageHelper.startPage(pageNum, pageSize);
        return adminUserMapper.getOrdinaryUser(keyword);
    }

    @Override
    public List<User> getVipUser(Integer pageNum, Integer pageSize,String keyword) {
        PageHelper.startPage(pageNum, pageSize);
        return adminUserMapper.getVipUser(keyword);
    }

    @Override
    public List<User> getBlacklistedUser(Integer pageNum, Integer pageSize,String keyword)  {
        PageHelper.startPage(pageNum, pageSize);
        return adminUserMapper.getBlacklistedUser(keyword);
    }

    @Override
    public boolean addToBlacklist(Integer id) {
        return adminUserMapper.addToBlacklist(id);
    }

    @Override
    public boolean removeToBlacklist(Integer id) {
        return adminUserMapper.removeToBlacklist(id);
    }

    @Override
    public String getUserMail(Integer id) {
        return adminUserMapper.getUserMail(id);
    }



}
